﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace WpfRcp.Modules.Panels.Views.Controllers
{
    public class ContentProcessor
    {
        public TextReader GetInput(string path)
        {
            var inputFileStream = File.Open(path, FileMode.Open);
            return new StreamReader(inputFileStream);
        }

        public TextWriter GetOutput(string savePath, string fileName)
        {
            var fullName = Path.Combine(savePath, fileName);
            var info = new FileInfo(fullName);
            if (info.Exists)
            {
                return null;
            }

            Stream outputFileStream = File.Open(fullName, FileMode.Create);
            return new StreamWriter(outputFileStream);
        }
    }
}
